var vm = new Vue({
    el:"#app",
    delimiters: ['[[', ']]'], // 修改vue模板符号，防止与django冲突
    data: {
        // page_size:5,
        // ordering:'-create_time',  //倒排
        host: HOST,
        //新闻列表数据
        category_id: "",
        head_title: "",
        username: localStorage.username || sessionStorage.username,//用户名
        token:localStorage.token || sessionStorage.token,
    },

    mounted: function () {
        CKEDITOR.replace('editor1');

    },


    //js动态加载获取数据
    methods: {


        //获取指定类别新闻列表
        submit_hl: function () {

            var content_edict = CKEDITOR.instances.editor1.getData();
            axios.post(this.host + '/news/submit/', {
                    user_id: this.user_id,
                    title: this.headline_title,
                    category: this.category_id,
                    content: content_edict,
                }, {
                    headers: {
                        'Authorization': 'JWT ' + this.token
                    },
                    responseType: 'json'
                }
            )
                .then(response => {
                    window.location.href='/headline-logined.html?cid=3'
                })
                .catch(error => {
                    console.log(error)
                })


        }



    }




})

